import Vue from 'vue';
import store from '@/store';

Vue.directive('permission', {
  inserted(el, binding) {
    const buttons = store.state.menus.buttons;
    // 管理员权限
    const adminPermission = '*:*:*';
    if (buttons.includes(adminPermission)) {
      return;
    } else {
      if (!buttons.includes(binding.value)) {
        el.remove();
      }
    }
  },
});
